<?php 
namespace App\Http\Controllers\User;

use App\Http\Controllers\Controller;
use Session;

class LoginController extends Controller
{
	public function __construct()
	{
		$this->middleware('loadnav');
	}

	public function Index()
	{
		$OAuth = config('OAuth');
		$state = md5(time().'_OAuth2.0');
		Session::flash('OAuth2.0_state', $state);
		$OAuth_List = array();
		foreach ($OAuth as $key => $value) {
			$OAuth_List[$key] = $value['Login_Url'].$state;
		}
		return view('user.Login', ['OAuth_List' => $OAuth_List]);
	}

	public function Out(){
		Session::flush();
		return redirect($_SERVER['HTTP_REFERER']);
	}
}